module WWW
  class Tkd
    class Utils
      class Misc
        #校验旺旺插件传递参数安全性
        def self.validate_parameter user_id,app_instance_id,hash_code,is_seller
          hash_plain_text = "#{user_id}#{app_instance_id}#{WWW::Tkd.get_buyer_hask_key}"
          if is_seller
            hash_plain_text = "#{user_id}#{app_instance_id}#{WWW::Tkd.get_seller_hask_key}"
          end
          server_hash_code = Digest::MD5.hexdigest(hash_plain_text)
          if server_hash_code!=hash_code
            return false
          end
          return true
        end
        #获得旺旺插件过来的淘宝登录用户名
        def self.get_domain_login_id_from_ww domain_login_id
            return domain_login_id.sub(/cntaobao/,'')
        end
      end
    end
  end
end
